<?php /** 响应数据 **/
class RespJson{
    /** 构造私有 **/
    private function __construct(){}

    /** 成功 *
     * @param array $data
     */
    public static function success($data = array()): void{
        echo json_encode(array(
            'code' => 200,
            'message' => "操作成功",
            'data' => $data
        ));
    }

    /** 失败 *
     * @param string $message
     * @param array $data
     */
    public static function fail($message = "操作失败", $data = array()): void{
        echo json_encode(array(
            'code' => 300,
            'message' => $message,
            'data' => $data
        ));
    }
    /** 防止类被克隆 **/
    public function __clone(){}
}